home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-10-25 | 21.5 KB | 766 lines | [TEXT/MPS ] |
- {[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]}
-
- { UTEDocument.inc1.p }
- { Copyright © 1990 by Apple Computer, Inc. All rights reserved. }
-
- {--------------------------------------------------------------------------------------------------}
- {$S AOpen}
-
- PROCEDURE TTEDocument.ITEDocument(itsFileType, itsCreator: OSType;
- usesDataFork, usesRsrcFork: BOOLEAN;
- keepsDataOpen, keepsRsrcOpen: BOOLEAN);
-
- BEGIN
- fDocText := NIL;
- IDocument(itsFileType, itsCreator, usesDataFork, usesRsrcFork, keepsDataOpen, keepsRsrcOpen);
-
- fTEView := NIL;
- fStyles := NIL;
- fElements := NIL;
- fDocText := NewPermHandle(0);
- FailNIL(fDocText);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S AClose}
-
- PROCEDURE TTEDocument.Free; OVERRIDE;
-
- BEGIN
- fDocText := DisposeIfHandle(fDocText);
-
- INHERITED Free;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S ANonRes}
-
- PROCEDURE TTEDocument.ChangeBackColor(newColor: RGBColor);
-
- VAR
- oldPort: GrafPtr;
- itsWindow: TWindow;
-
- BEGIN
- {??? Is this right? Should we set the background color even if the view isn't
- in a window yet? }
- GetPort(oldPort);
- SetPort(fTEView.fHTE^^.inPort);
- RGBBackColor(newColor);
- itsWindow := fTEView.GetWindow;
- IF itsWindow <> NIL THEN
- itsWindow.ForceRedraw;
- SetPort(oldPort);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S AOpen}
-
- PROCEDURE TTEDocument.DoInitialState; OVERRIDE;
-
- BEGIN
- fTextSpecs := gDefaultSpecs;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S AOpen}
-
- PROCEDURE TTEDocument.DoMakeViews(forPrinting: BOOLEAN); OVERRIDE;
-
- VAR
- aView: TView;
- aHandler: TStdPrintHandler;
-
- BEGIN
- IF forPrinting THEN
- { We're only finder printing--don't need a window, just the view being printed }
- aView := DoCreateViews(SELF, NIL, kViewRsrcID, gZeroVPt)
- ELSE
- aView := NewTemplateWindow(kWindowRsrcID, SELF);
-
- FailNIL(aView); { ??? Will we have already failed?}
- aView := aView.FindSubView('TEVW');
- fTEView := TTEView(aView); { Must cast because FindSubView returns
- TView }
- New(aHandler);
- FailNIL(aHandler);
- aHandler.IStdPrintHandler(SELF, { its document }
- fTEView, { its view }
- NOT kSquareDots, { does not have square dots }
- kFixedSize, { horzontal page size is fixed }
- NOT kFixedSize); { vertical page size is variable (could be
- set to true on non-style TE systems) }
-
- ShowReverted;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S ASelCommand}
-
- FUNCTION TTEDocument.DoMenuCommand(aCmdNumber: CmdNumber): TCommand; OVERRIDE;
-
- VAR
- sd: SizeDeterminer;
- aName: Str255;
- menu: INTEGER;
- item: INTEGER;
- newStyle: TextStyle;
- aStyleItem: StyleItem;
-
- {--------------------------------------------------------------------------------------------------}
-
- PROCEDURE DoSizeChange(base: CmdNumber);
-
- BEGIN
- newStyle.tsSize := aCmdNumber - base;
- fTextSpecs.theTextSize := newStyle.tsSize;
- DoMenuCommand := fTEView.DoMakeStyleCommand(newStyle, cSizeChange, doSize + doToggle);
- END;
-
- {--------------------------------------------------------------------------------------------------}
-
- PROCEDURE DoRelSizeChange(amount: INTEGER);
-
- BEGIN
- newStyle.tsSize := amount;
- WITH fTextSpecs DO
- theTextSize := theTextSize + amount;
- DoMenuCommand := fTEView.DoMakeStyleCommand(newStyle, cSizeChange, doSize +
- addSize + doToggle);
- END;
-
- {--------------------------------------------------------------------------------------------------}
-
- PROCEDURE DoFontChange;
-
- BEGIN
- GetItem(GetMHandle(menu), item, aName);
- GetFNum(aName, newStyle.tsFont);
- fTextSpecs.theTextFont := aName;
- DoMenuCommand := fTEView.DoMakeStyleCommand(newStyle, cFontChange, doFont + doToggle);
- END;
-
- {--------------------------------------------------------------------------------------------------}
-
- PROCEDURE DoColTextChange;
-
- VAR
- aColor: RGBColor;
- promptString: Str255;
-
- BEGIN
- aColor := fTextSpecs.theTextColor;
- GetIndString(promptString, kPromptsRsrcID, kColTextPrompt);
- IF GetColor(Point($00400040), promptString, aColor, newStyle.tsColor) THEN
- BEGIN
- fTextSpecs.theTextColor := newStyle.tsColor;
- DoMenuCommand := fTEView.DoMakeStyleCommand(newStyle, cColorChange, doColor + doToggle);
- END;
- END;
-
- {--------------------------------------------------------------------------------------------------}
-
- PROCEDURE DoColBackChange;
-
- VAR
- aColor: RGBColor;
- promptString: Str255;
-
- BEGIN
- aColor := fTextSpecs.theBackColor;
- GetIndString(promptString, kPromptsRsrcID, kColBackPrompt);
- IF GetColor(Point($00400040), promptString, aColor, newStyle.tsColor) THEN
- BEGIN
- fTextSpecs.theBackColor := newStyle.tsColor;
- ChangeBackColor(newStyle.tsColor);
- END;
- END;
-
- {--------------------------------------------------------------------------------------------------}
-
- PROCEDURE DoJustChange;
-
- VAR
- newJust: INTEGER;
- aJustChange: TJustCommand;
-
- BEGIN
- CASE aCmdNumber OF
- cJustSystem:
- newJust := teJustSystem; { Use the MacApp supplied constant since the
- TextEdit supplied constant (teJustLeft)
- can be misleading. teJustLeft actually
- means use the current system
- justification. See UMacAppUtilities for
- more details }
- cJustForceLeft:
- newJust := teForceLeft;
- cJustCenter:
- newJust := teJustCenter;
- cJustRight:
- newJust := teJustRight;
- END;
- New(aJustChange);
- FailNIL(aJustChange);
- aJustChange.IJustCommand(fTEView, newJust);
- fTextSpecs.theJustification := newJust;
- DoMenuCommand := aJustChange;
- END;
-
- {--------------------------------------------------------------------------------------------------}
-
- PROCEDURE DoPlainChange;
-
- BEGIN
- newStyle.tsFace := [];
- fTextSpecs.theTextFace := [];
- DoMenuCommand := fTEView.DoMakeStyleCommand(newStyle, cStyleChange, doFace);
- END;
-
- {--------------------------------------------------------------------------------------------------}
-
- PROCEDURE DoStyleChange;
-
- BEGIN
- WITH fTextSpecs, newStyle DO
- BEGIN
- CASE aCmdNumber OF
- cBold:
- tsFace := [bold];
- cItalic:
- tsFace := [italic];
- cUnderline:
- tsFace := [underline];
- cOutline:
- tsFace := [outline];
- cShadow:
- tsFace := [shadow];
- cCondense:
- tsFace := [condense];
- cExtend:
- tsFace := [extend];
- END;
- IF tsFace * theTextFace = tsFace THEN
- theTextFace := theTextFace - tsFace
- ELSE
- theTextFace := theTextFace + tsFace;
- END;
- DoMenuCommand := fTEView.DoMakeStyleCommand(newStyle, cStyleChange, doFace + doToggle);
- END;
-
- {--------------------------------------------------------------------------------------------------}
-
- PROCEDURE InstallChangedDeterminer(vhs: VHSelect);
-
- BEGIN
- IF sd <> fTEView.fSizeDeterminer[vhs] THEN
- BEGIN
- fTEView.fSizeDeterminer[vhs] := sd;
-
- { If we changed the horizontal size determiner,
- we must ask the TTEView to recompute the TE rectangles. }
- IF vhs = h THEN
- BEGIN
- IF sd = sizeSuperView THEN
- fTEView.SuperViewChangedSize(gZeroVPt, TRUE) { Don't care about deltas}
- ELSE IF sd = sizePage THEN
- fTEView.DoPagination;
- END;
-
- fTEView.AdjustSize;
- fTEView.ForceRedraw;
- END;
- END;
-
- {--------------------------------------------------------------------------------------------------}
-
- PROCEDURE DoWidthChange;
-
- BEGIN
- IF aCmdNumber = cWidthSuperView THEN
- sd := sizeSuperView
- ELSE IF aCmdNumber = cWidthOnePage THEN
- sd := sizePage
- ELSE
- sd := sizeFixed;
-
- InstallChangedDeterminer(h); { NB: The following is not undoable in the
- current version }
- END;
-
- {--------------------------------------------------------------------------------------------------}
-
- PROCEDURE DoHeightChange;
-
- BEGIN
- CASE aCmdNumber OF
- cHeightSuperView:
- sd := sizeSuperView;
- cHeightPages:
- sd := sizeFillPages;
- cHeightText:
- sd := sizeVariable;
- cHeightConst:
- sd := sizeFixed;
- END;
-
- InstallChangedDeterminer(v); { NB: The following is not undoable in the
- current version }
- END;
-
- BEGIN { DoMenuCommand }
- DoMenuCommand := NIL;
-
- CmdToMenuItem(aCmdNumber, menu, item);
-
- IF menu = mFont THEN
- DoFontChange
- ELSE
- CASE aCmdNumber OF
- cSizeMin..cSizeMax:
- DoSizeChange(cSizeBase);
-
- cSizeGrow:
- DoRelSizeChange(kRelSizeAmount);
-
- cSizeShrink:
- DoRelSizeChange( - kRelSizeAmount);
-
- cJustForceLeft..cJustSystem:
- DoJustChange;
-
- cPlainText:
- DoPlainChange;
-
- cBold..cExtend:
- DoStyleChange;
-
- cColorText:
- DoColTextChange;
-
- cColorBackground:
- DoColBackChange;
-
- cWidthSuperView..cWidthOnePage:
- DoWidthChange;
-
- cHeightSuperView..cHeightConst:
- DoHeightChange;
-
- OTHERWISE
- DoMenuCommand := INHERITED DoMenuCommand(aCmdNumber);
- END;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S AWriteFile}
-
- PROCEDURE TTEDocument.DoNeedDiskSpace(VAR dataForkBytes, rsrcForkBytes: LONGINT); OVERRIDE;
-
- VAR
- styles: TEStyleHandle;
- elements: STHandle;
-
- BEGIN
- dataForkBytes := dataForkBytes + GetHandleSize(fDocText);
-
- rsrcForkBytes := rsrcForkBytes + kPrintInfoSize + kRsrcTypeOverhead + kRsrcOverhead;
-
- IF (fTEView.fStyleType = kWithStyle) & (fTEView.fHTE <> NIL) THEN
- BEGIN
- fTEView.ExtractStyles(styles, elements);
- rsrcForkBytes := rsrcForkBytes + GetHandleSize(Handle(styles)) + kRsrcTypeOverhead +
- kRsrcOverhead + GetHandleSize(Handle(elements)) + kRsrcTypeOverhead +
- kRsrcOverhead;
- END;
-
- rsrcForkBytes := rsrcForkBytes + SIZEOF(TextSpecs) + kRsrcTypeOverhead + kRsrcOverhead;
-
- { Get resource file overhead }
- INHERITED DoNeedDiskSpace(dataForkBytes, rsrcForkBytes);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S AReadFile}
-
- PROCEDURE TTEDocument.DoRead(aRefNum: INTEGER;
- rsrcExists, forPrinting: BOOLEAN); OVERRIDE;
-
- VAR
- numChars: LONGINT;
- hTextSpecs: TextSpecsHdl;
- hPrintInfo: Handle;
-
- BEGIN
- FailOSErr(GetEOF(aRefNum, numChars)); { Read in the text }
-
- IF numChars > kUnlimited THEN { The file may have been created by… }
- BEGIN { …someone else - limit it to 32K! }
- gApplication.ShowError(0, msgAlert + kFileTooBig);
- numChars := kUnlimited;
- END;
-
- SetHandleSize(fDocText, numChars);
- FailMemError;
- FailOSErr(FSRead(aRefNum, numChars, fDocText^));
-
- fStyles := { Read in the TEStyleRec }
- TEStyleHandle(GetResource(kTextStyleRsrcType, kStylesRsrcID));
- IF fStyles <> NIL THEN
- DetachResource(Handle(fStyles));
-
- fElements := { Read in the STElement array }
- STHandle(GetResource(kTextStyleRsrcType, kElementsRsrcID));
- IF fElements <> NIL THEN
- DetachResource(Handle(fElements));
-
- hTextSpecs := { Read the text specs resource }
- TextSpecsHdl(GetResource(kTextSpecsRsrcType, kTextSpecsRsrcID));
- IF hTextSpecs <> NIL THEN
- fTextSpecs := hTextSpecs^^
- ELSE
- DoInitialState;
-
- hPrintInfo := { Read the print info resource }
- GetResource(kPrintInfoRsrcType, kPrintInfoRsrcID);
- IF hPrintInfo <> NIL THEN { no print info resource was saved }
- BEGIN
- IF fPrintInfo = NIL THEN
- BEGIN
- fPrintInfo := NewPermHandle(kPrintInfoSize);
- FailNIL(fPrintInfo);
- END;
- BlockMove(hPrintInfo^, fPrintInfo^, kPrintInfoSize);
- END;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S ARes}
-
- PROCEDURE TTEDocument.DoSetupMenus; OVERRIDE;
-
- VAR
- checkPlain: BOOLEAN;
- checkSize: BOOLEAN;
- checkFont: BOOLEAN;
- specChange: BOOLEAN;
- just: INTEGER;
- item: INTEGER;
- fnt: INTEGER;
- c: INTEGER;
- aMode: INTEGER;
- aFace: Style;
- sd: SizeDeterminer;
- aMenuHandle: MenuHandle;
- aName: Str255;
- aStyle: TextStyle;
- theFont: INTEGER;
- startOfSelection, endOfSelection: INTEGER;
- aStr255: Str255;
-
- BEGIN
- INHERITED DoSetupMenus;
-
- IF qNeedsStyleTextEdit | gConfiguration.hasStyleTextEdit THEN
- BEGIN
- WITH fTEView.fHTE^^ DO
- BEGIN
- startOfSelection := selStart;
- endOfSelection := selEnd;
- END;
- aMode := doFace;
- checkPlain := fTEView.ContinuousStyle(startOfSelection, endOfSelection, aMode, aStyle) &
- (aStyle.tsFace = []);
-
- aMode := doAll;
- aStyle.tsFace := [bold, italic, underline, outline, shadow, extend, condense];
- specChange := fTEView.ContinuousStyle(startOfSelection, endOfSelection, aMode, aStyle);
- checkFont := (BAND(aMode, doFont) <> 0);
- END
- ELSE
- BEGIN
- aStr255 := fTextSpecs.theTextFont;
- GetFNum(aStr255, aStyle.tsFont);
- WITH aStyle, fTextSpecs DO
- BEGIN
- tsFace := theTextFace;
- tsSize := theTextSize;
- tsColor := theTextColor;
- END;
- checkPlain := aStyle.tsFace = [];
- checkFont := TRUE;
- END;
-
- aMenuHandle := GetMHandle(mFont);
- { If specs have changed AND EITHER an old-style record OR the font's continuous - Ed. }
- specChange := fTEView.fSpecsChanged & ((NOT (qNeedsStyleTextEdit |
- gConfiguration.hasStyleTextEdit)) | checkFont);
-
- GetFontName(aStyle.tsFont, aName); { Get real font number in case tsFont is }
- GetFNum(aName, theFont); { …the system or application font. }
- FOR item := 1 TO CountMItems(aMenuHandle) DO
- BEGIN
- { There can be more than 31 menu entries with scrolling menus, but trying to enable
- an item with number > 31 is bad news. If the menu itself is enabled (which it
- will be in MacApp if any of the first 31 items is enabled), then the extras
- will always be enabled. }
- IF item <= 31 THEN
- EnableItem(aMenuHandle, item);
- IF checkFont THEN
- BEGIN
- GetItem(aMenuHandle, item, aName);
- GetFNum(aName, fnt);
- CheckItem(aMenuHandle, item, fnt = theFont);
- END;
- END;
-
- sd := fTEView.fSizeDeterminer[h]; { Enable size determiner related menu items
- }
- EnableCheck(cWidthSuperView, TRUE, (sd = sizeSuperView));
- EnableCheck(cWidthOnePage, TRUE, (sd = sizePage));
- EnableCheck(cWidthView, TRUE, (sd = sizeFixed));
-
- sd := fTEView.fSizeDeterminer[v];
- EnableCheck(cHeightSuperView, TRUE, (sd = sizeSuperView));
- EnableCheck(cHeightPages, TRUE, (sd = sizeFillPages));
- EnableCheck(cHeightText, TRUE, (sd = sizeVariable));
- EnableCheck(cHeightConst, TRUE, (sd = sizeFixed));
-
- just := fTEView.fJustification; { Enable justification related menu items }
- EnableCheck(cJustSystem, TRUE, (just = teJustSystem));
- EnableCheck(cJustForceLeft, TRUE, (just = teForceLeft));
- EnableCheck(cJustCenter, TRUE, (just = teJustCenter));
- EnableCheck(cJustRight, TRUE, (just = teJustRight));
-
- IF qNeedsHierarchicalMenus | gConfiguration.hasHierarchicalMenus THEN
- BEGIN
- Enable(cStyle, TRUE); { Enable sub-menus }
- Enable(cSize, TRUE);
- Enable(cFont, TRUE);
- Enable(cColor, qNeedsColorQD | gConfiguration.hasColorQD);
- END;
-
- aFace := aStyle.tsFace;
- EnableCheck(cPlainText, TRUE, checkPlain); { Enable normal Style menu items }
- EnableCheck(cBold, TRUE, bold IN aFace);
- EnableCheck(cItalic, TRUE, italic IN aFace);
- EnableCheck(cUnderline, TRUE, underline IN aFace);
- EnableCheck(cOutline, TRUE, outline IN aFace);
- EnableCheck(cShadow, TRUE, shadow IN aFace);
- EnableCheck(cCondense, TRUE, condense IN aFace);
- EnableCheck(cExtend, TRUE, extend IN aFace);
-
- FOR c := cSizeMin TO cSizeMax DO
- BEGIN
- IF (qNeedsStyleTextEdit | gConfiguration.hasStyleTextEdit) & (BAND(aMode, doSize) = 0) THEN
- checkSize := FALSE
- ELSE
- checkSize := (c - cSizeBase) = aStyle.tsSize;
-
- EnableCheck(c, TRUE, checkSize);
- IF fTEView.fSpecsChanged THEN
- BEGIN
- IF ((NOT (qNeedsStyleTextEdit | gConfiguration.hasStyleTextEdit)) | { If the record
- isn't styled, or }
- (BAND(aMode, doFont) <> 0)) & { …it _is_ styled and font is continuous }
- RealFont(aStyle.tsFont, { …and the size is a real one }
- c - cSizeBase) THEN
- aFace := [outline] { …then we outline it }
- ELSE
- aFace := [];
- SetStyle(c, aFace);
- END;
- END;
-
- Enable(cSizeGrow, TRUE);
- Enable(cSizeShrink, TRUE);
-
- Enable(cColorText, qNeedsColorQD | gConfiguration.hasColorQD);
- Enable(cColorBackground, qNeedsColorQD | gConfiguration.hasColorQD);
-
- fTEView.fSpecsChanged := FALSE;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S AWriteFile}
-
- PROCEDURE TTEDocument.DoWrite(aRefNum: INTEGER;
- makingCopy: BOOLEAN); OVERRIDE;
-
- VAR
- numChars: LONGINT;
- hTextSpecs: TextSpecsHdl;
- tempHandle: Handle;
- styles: TEStyleHandle;
- elements: STHandle;
-
- BEGIN
- { Write out the text }
- numChars := GetHandleSize(fDocText);
- FailOSErr(FSWrite(aRefNum, numChars, fDocText^));
-
- IF fTEView.fStyleType = kWithStyle THEN
- BEGIN
- fTEView.ExtractStyles(styles, elements);
- FailOSErr(HandToHand(Handle(styles)));
- AddResource(Handle(styles), kTextStyleRsrcType, kStylesRsrcID, '');
- FailResError;
- FailOSErr(HandToHand(Handle(elements)));
- AddResource(Handle(elements), kTextStyleRsrcType, kElementsRsrcID, '');
- FailResError;
- END;
-
- { Write the text specification resource, after converting it to a handle }
- hTextSpecs := TextSpecsHdl(NewHandle(SIZEOF(TextSpecs)));
- FailNIL(hTextSpecs);
- hTextSpecs^^ := fTextSpecs;
- AddResource(Handle(hTextSpecs), kTextSpecsRsrcType, kTextSpecsRsrcID, '');
-
- FailResError;
-
- { Write the print info resource. Note we can't use MacApp for this because MacApp
- will write the print info into the data fork. Note also--we must copy the print
- info resource to another handle because the Resource Manager will dispose of the
- resource handles when a resource fork is closed. }
- IF fPrintInfo <> NIL THEN { Make sure we have one of these guys}
- BEGIN
- tempHandle := fPrintInfo;
- FailOSErr(HandToHand(tempHandle));
- AddResource(tempHandle, kPrintInfoRsrcType, kPrintInfoRsrcID, '');
- FailResError;
- END;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S AClose}
-
- PROCEDURE TTEDocument.FreeData; OVERRIDE;
-
- BEGIN
- SetHandleSize(fDocText, 0);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S ARes}
-
- PROCEDURE TTEDocument.SetSpecStyle;
-
- VAR
- theFont: INTEGER;
- theTS: TextStyle;
- aStr255: Str255;
-
- BEGIN
- aStr255 := fTextSpecs.theTextFont;
- GetFNum(aStr255, theFont);
- {$Push} {$H-}
- WITH fTextSpecs DO
- SetTextStyle(theTS, theFont, theTextFace, theTextSize, theTextColor);
- {$Pop}
- fTEView.SetOneStyle(0, 0, doAll, theTS, kDontRedraw);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S AReadFile}
-
- PROCEDURE TTEDocument.ShowReverted; OVERRIDE;
-
- VAR
- aColor: RGBColor;
-
- BEGIN
- fTEView.StuffText(fDocText); { put in the text }
- TESetSelect(0, 0, fTEView.fHTE);
- IF (fStyles <> NIL) & (fElements <> NIL) THEN { If we're able, stuff style info }
- fTEView.StuffStyles(fStyles, fElements)
- ELSE
- SetSpecStyle;
-
- IF qNeedsColorQD | gConfiguration.hasColorQD THEN
- BEGIN
- aColor := fTextSpecs.theBackColor;
- ChangeBackColor(aColor);
- END;
- fTEView.SetJustification(fTextSpecs.theJustification, kDontRedraw);
- INHERITED ShowReverted;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S AFields}
-
- PROCEDURE TTEDocument.Fields(PROCEDURE DoToField(fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: INTEGER)); OVERRIDE;
-
- BEGIN
- DoToField('TTEDocument', NIL, bClass);
- DoToField('fDocText', @fDocText, bHandle);
- DoToField('fTEView', @fTEView, bObject);
- DoToField(' fTextSpecs', NIL, bClass);
- DoToField(' theTextFont', @fTextSpecs.theTextFont, bString);
- DoToField(' theTextFace', @fTextSpecs.theTextFace, bStyle);
- DoToField(' theTextSize', @fTextSpecs.theTextSize, bInteger);
- DoToField(' theTextColor', @fTextSpecs.theTextColor, bRGBColor);
- DoToField(' theJustification', @fTextSpecs.theJustification, bInteger);
- DoToField(' theBackColor', @fTextSpecs.theBackColor, bRGBColor);
- INHERITED Fields(DoToField);
- END;
-
- {******************************************************************************************}
- { T J u s t C o m m a n d }
- {******************************************************************************************}
- {--------------------------------------------------------------------------------------------------}
- {$S ASelCommand}
-
- PROCEDURE TJustCommand.IJustCommand(itsTEView: TTEView;
- itsNewJust: INTEGER);
-
- BEGIN
- ICommand(cJustChange, itsTEView.fDocument, NIL, NIL);
- fTEView := itsTEView;
- fOldJust := itsTEView.fJustification;
- fNewJust := itsNewJust;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S ADoCommand}
-
- PROCEDURE TJustCommand.DoIt; OVERRIDE;
-
- BEGIN
- fTEView.SetJustification(fNewJust, kRedraw);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S ADoCommand}
-
- PROCEDURE TJustCommand.RedoIt; OVERRIDE;
-
- BEGIN
- DoIt;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S ADoCommand}
-
- PROCEDURE TJustCommand.UndoIt; OVERRIDE;
-
- BEGIN
- fTEView.SetJustification(fOldJust, kRedraw);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S AFields}
-
- PROCEDURE TJustCommand.Fields(PROCEDURE DoToField(fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: INTEGER)); OVERRIDE;
-
- BEGIN
- DoToField('TJustCommand', NIL, bClass);
- DoToField('fTEView', @fTEView, bObject);
- DoToField('fOldJust', @fOldJust, bInteger);
- DoToField('fNewJust', @fNewJust, bInteger);
- INHERITED Fields(DoToField);
- END;
-